﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using AOP.Filter.Jurisdiction;
using AOP.Filter.Result;
using CacheService.Standard;
using Microsoft.AspNetCore.Mvc;
using MODEL.Model;
using SERVICE.Admin.IService;

namespace Admin.Controllers
{
    [NoJurisdiction]
    public partial class HomeController : Controller
    {
        ISyetemService syetemService;
        ICache cache;
        public HomeController(ISyetemService syetemService, ICache cache) {
            this.syetemService = syetemService;
            this.cache = cache;
        }
        [Native]
        public IActionResult Index(string id,int ss)
        {
            return View();
        }
        [Native]
        public IActionResult MdyPass(int ic=1) {
            return View();
        }
        [HttpPost]
        public bool UpdatePass(string oldPass, string newPass) {
            var key = Request.Cookies["key"];
            var user = cache.get<SystemManager>(key);
            return syetemService.UpdatePass(user.id, oldPass, newPass);
        }
    }
}
